#include <iostream>
#include <string>

int GetDecimal(const std::string& line) {
    int result = 0;
    for (int i = line.size() - 1; i >= 0; i--) {
        result+= (line[i] - '0') * (1 << (line.size() - 1 - i));
    }
    return result;
}

void Solution1(){
    std::string line;
    std::cin >> line;

    if(line[0]=='1') {
        for(int i=0;i<line.size();i++) {
            if (line[i]=='1') {
                line[i] = '0';
            }else {
                line[i] = '1';
            }
        
        }

        int carry = 0;
        line[line.size() - 1] = (char)(line[line.size() - 1] + 1);
        for(int i=line.size()-1;i>=0;i--) {
            int num = line[i] - '0' + carry;
            line[i] = (char)((num) % 2 + '0');
            carry = num / 2;
        }

        std::cout << "-" << GetDecimal(line);
    }else {
        std::cout << GetDecimal(line);

    }
}

void Solution2(){
    std::string s;
    std::cin >> s;
    int n = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '1') {
            n |= (1 << (31 - i));
        }
    }
    std::cout << n;
    return 0;
}

/**
 * 算补码
 */
int main() {


    
    return 0;
}